﻿using Microsoft.SharePoint.WebControls;
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

namespace SPUpToNav.ControlTemplates.SPUpToNav
{
    public partial class SPUpToNav : UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }

        protected override void CreateChildControls()
        {
            var masterPage = this.Page.Master;
            var delta = masterPage.FindControl("DeltaBreadcrumbDropdown") as AjaxDelta;
            if (delta != null)
            {
                var breadcrumb = delta.FindControl("GlobalBreadCrumbNavPopout") as PopoutMenu;
                if (breadcrumb != null)
                {
                    breadcrumb.Visible = true;
                    breadcrumb.ThemeKey = "spcommon";
                    breadcrumb.IconUrl = "/_layouts/15/images/spcommon.png";
                    this.Controls.Add(new LiteralControl("<style type=\"text/css\">.ms-breadcrumb-dropdownBox { display: inline-block !important; }</style>"));
                }
            }
            base.CreateChildControls();
        }
    }
}
